using System;
using System.Collections.Generic;
using data.contracts;

namespace twittersearch
{
    public class TwitterSearch
    {
        private readonly Action<string> search;

        public TwitterSearch() {
            var twitter = new Twitter();
            var mapper = new Mapper();

            twitter.Out_Result += mapper.In_Map;
            mapper.Out_Result += tweets => Out_Update(tweets);

            search = query => twitter.In_Search(query);
        }

        public event Action<IEnumerable<Tweet>> Out_Update;

        public void In_Search(string query) {
            search(query);
        }
    }
}